package cn.iocoder.yudao.module.member.dal.mysql.user;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.user.vo.CrmMemberUserExportReqVO;
import cn.iocoder.yudao.module.member.controller.admin.user.vo.CrmMemberUserPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserGasAddressDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 燃气户 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CrmMemberUserMapper extends BaseMapperX<MemberUserGasAddressDO> {

    List<String> selectDateByMonth(MemberUserPageReqVO reqVO);

    List<MemberUserGasAddressDO> selectCrmList(CrmMemberUserPageReqVO reqVO);

    default PageResult<MemberUserGasAddressDO> selectPage(CrmMemberUserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MemberUserGasAddressDO>()
                .eqIfPresent(MemberUserGasAddressDO::getCode, reqVO.getCode())
                .likeIfPresent(MemberUserGasAddressDO::getName, reqVO.getName())
                .eqIfPresent(MemberUserGasAddressDO::getIdNumber, reqVO.getIdNumber())
                .likeIfPresent(MemberUserGasAddressDO::getMobile, reqVO.getMobile())
                .likeIfPresent(MemberUserGasAddressDO::getDetailAddress, reqVO.getDetailAddress())
                .eqIfPresent(MemberUserGasAddressDO::getAccountType, reqVO.getAccountType())
                .inIfPresent(MemberUserGasAddressDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MemberUserGasAddressDO::getCreateTime, reqVO.getOpenTime())
                .orderByDesc(MemberUserGasAddressDO::getId));
    }

    default List<MemberUserGasAddressDO> selectList(CrmMemberUserExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MemberUserGasAddressDO>()
                .eqIfPresent(MemberUserGasAddressDO::getCode, reqVO.getCode())
                .likeIfPresent(MemberUserGasAddressDO::getCrmName, reqVO.getCrmName())
                .likeIfPresent(MemberUserGasAddressDO::getName, reqVO.getName())
                .eqIfPresent(MemberUserGasAddressDO::getIdNumber, reqVO.getIdNumber())
                .eqIfPresent(MemberUserGasAddressDO::getMobile, reqVO.getMobile())
                .likeIfPresent(MemberUserGasAddressDO::getDetailAddress, reqVO.getDetailAddress())
                .eqIfPresent(MemberUserGasAddressDO::getFloor, reqVO.getFloor())
                .eqIfPresent(MemberUserGasAddressDO::getLift, reqVO.getLift())
                .eqIfPresent(MemberUserGasAddressDO::getPhone, reqVO.getPhone())
                .eqIfPresent(MemberUserGasAddressDO::getAccountType, reqVO.getAccountType())
                .inIfPresent(MemberUserGasAddressDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MemberUserGasAddressDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MemberUserGasAddressDO::getId));
    }


}
